<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="com.alpha.bom.*" %>
<%@	taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>All Results</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/displaytag.css"/>

</head>
<body>

	<c:set var="user" value="${sessionScope.user}"></c:set>
	<c:set var="examResponses" value="${requestScope.examResponses}"></c:set>
	
	<c:if test="${user.userType ne 'Professor'}" >
		<c:redirect url="LoginServlet"></c:redirect>
	</c:if>
	
	<div id="header"><%@ include file="Header.jsp"%></div>
	<div id="content">
	<div id="navbar"><%@ include file="NavigationBar.jsp"%></div>
	<div id="main">
			
			<div class="box">
				<div class="box-header well">
					<h2><i class="icon-th-list"></i> All Results</h2>
					<div class="box-icon">
						<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
					</div>
				</div>
				<div class="box-content">
					<display:table name="examResponses" id="examResponse" export="true" class="table table-striped table-bordered bootstrap-datatable datatable">
						<display:column title="Student ID">${examResponse.student.userId}</display:column>
						<display:column title="Student Name">${examResponse.student.lastName}, ${examResponse.student.firstName}</display:column>
						<display:column title="Exam Name">${examResponse.exam.examName}</display:column>
						<display:column title="Date Taken">${examResponse.dateTaken}</display:column>
						<display:column title="Score">${examResponse.computeScore()}/${examResponse.exam.questions.size()}</display:column>
						<display:column title="Action" media="html">
							<a class="btn btn-info" href="StudentResponseServlet?exam_response_id=${examResponse.examResponseId}"><i class=" icon-info-sign"></i> View Details</a>
						</display:column>
						
						<display:caption media="pdf excel csv xml rtf">All Students' Exams</display:caption>
								
						<display:setProperty name="export.pdf" value="true"/>
						<display:setProperty name="export.pdf.filename" value="export.pdf"/>
						<display:setProperty name="export.excel.filename" value="export.xls"/>
						<display:setProperty name="export.csv.filename" value="export.csv"/>
						<display:setProperty name="export.xml.filename" value="export.xml"/>
						<display:setProperty name="export.rtf.filename" value="export.rtf"/>
						
					</display:table>
				</div>
			</div>
	
	</div>
	</div>
	
<script>
	$(document).ready(function() {
		$("span[class*='export']").parent().each(function() {
			this.href = this.href.replace("AllResults.jsp", "AllResultsServlet");
		});
	});
</script>
</body>
</html>